package com.grts.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.grts.pojo.ControllerMsg;
import com.grts.pojo.Curriculumcard;
import com.grts.pojo.Datenumber;
import com.grts.pojo.T_Class;
import com.grts.service.CurriculumcardServiceI;
import com.grts.service.DatenumberServiceI;
import com.grts.service.T_ClassServiceI;

@RequestMapping("/Curriculumcard")
@Controller
public class CurriculumcardController {
	@Resource
	private CurriculumcardServiceI curriculumcardServiceI;
	
	@Resource
	private T_ClassServiceI t_ClassServiceI;
	
	@Resource
	private DatenumberServiceI datenumberServiceI;
	
	private ControllerMsg controllerMsg;
	
	@RequestMapping("/goT_Class")
	public String goT_Class(Model model){
		List<T_Class> t_ClassList=t_ClassServiceI.queryClassAndCurriculumcard();
		model.addAttribute("t_ClassList", t_ClassList);
		return "curriculumcard/showClass";			
	}
	
	@RequestMapping("/queryByT_ClassId")
	public String queryByT_ClassId(Model model,@RequestParam(name="t_ClassId")Integer t_ClassId){
		//查询课程时间表
		List<Datenumber> datenumberList = datenumberServiceI.queryAll();
		model.addAttribute("datenumberList",datenumberList);
		//查询指定班级的课程安排表
		List<Curriculumcard> curriculumcardList = curriculumcardServiceI.queryByCurriculumClassId(t_ClassId);
		model.addAttribute("curriculumcardList",curriculumcardList);
		//存入班级告诉页面是哪个班级在排课	
		T_Class t_Class=t_ClassServiceI.selectByPrimaryKey(t_ClassId);
		model.addAttribute("t_Class", t_Class);
		return "curriculumcard/addCurriculumcard";
	}
	
	@RequestMapping("/goAddCurriculumcard")
	@ResponseBody
	public ControllerMsg goAddCurriculumcard(Integer curriculumdate){
		//查询未被占用的教室
		
		//查询还未安排的老师
		
		//查询所有课程
		
		return controllerMsg;
	}
}
